<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<meta name="decorator" content="default" />
<link href="${ctxStatic}/bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet">
<link href="${ctxStatic}/bootstrap/3.3.7/css/bootstrap-theme.min.css" rel="stylesheet">
<title>待办事项</title>
<script type="text/javascript">
$(document).ready(function() {
	//无代办时自动关闭窗口
	var todo = $(".todo");
	if (todo.length ==0){
		//$(".orderSum").html("今日暂无待办出入库单");
		setTimeout(function () {
			var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
			parent.layer.close(index);
		}, 3000);
	}
	
	//无订单时显示无
	var orderTodo = $(".orderTodo");
	if (orderTodo.length ==0){
		$(".orderSum").html("今日暂无待办出入库单");
	}else{
		$(".orderSum").html("您可以在【出入库操作】中及时处理这些出入库单。");
	}
});
</script>
<style type="text/css">
hr {
    border-top: 1px solid #ababab;
}
</style>
</head>
<body>
<div class="container-fluid" style = "padding-top: 5px;">
	<c:if test="${outDateList.size() > 0}">
		<shiro:hasAnyPermissions name="order:bsVaccineOrder:store,order:bsVaccineOrder:edit,order:bsVaccineOrder:audit">
		<div class="row-fluid">
			<p class = "outDateTitle">【近效期预警】
				<span class = "outDateSum">今日库存中有${outDateList.size()}个疫苗或注射器在近效期预警内（120天）。</span>
			</p>
			<c:forEach items="${outDateList}" var="outDate" begin="0" varStatus="status">
				<div class="todo">
					<p <c:if test="${outDate.OUT_DATE <= 120 && outDate.OUT_DATE > 90}">class="text-success"</c:if>
						<c:if test="${outDate.OUT_DATE <= 90 && outDate.OUT_DATE > 30}">class="text-warning"</c:if>
						<c:if test="${outDate.OUT_DATE <= 30 }">class="text-danger"</c:if>>
						【${outDate.VACCNAME} — ${outDate.BATCHNO}<c:if test="${not empty outDate.SECONDBATCHNO}">  <span title="(查询批号时不需要带入亚批号)" > -${outDate.SECONDBATCHNO}</span> </c:if>】：剩余 ${outDate.STORENUM}，（近效期 ${outDate.OUT_DATE} 天）
					</p>
				</div>
			</c:forEach>
		</div>
		<hr>
		</shiro:hasAnyPermissions>
	</c:if>
	<div class="row-fluid">
		<p class = "orderTitle">【出入库待办】<span class = "orderSum"></span></p>
		<c:forEach items="${orderList}" var="todo" begin="0" varStatus="status">
			<c:choose>
			    <c:when test="${todo.ORDERTYPE == 0 && todo.COUNT != 0}">
					<shiro:hasPermission name="order:bsVaccineOrder:audit">
						<p class = "orderTodo todo">【${todo.DES}】出入库单：${todo.COUNT}个；</p>
					</shiro:hasPermission>
			    </c:when>
			    <c:when test="${todo.ORDERTYPE == 11 && todo.COUNT != 0}">
					<shiro:hasPermission name="order:bsVaccineOrder:ticket">
						<p class = "orderTodo todo">【${todo.DES}】出入库单：${todo.COUNT}个；</p>
					</shiro:hasPermission>
			    </c:when>
			    <c:when test="${todo.ORDERTYPE == 1 && todo.COUNT != 0}">
					<shiro:hasPermission name="order:bsVaccineOrder:store">
						<p class = "orderTodo todo">【${todo.DES}】出入库单：${todo.COUNT}个；</p>
					</shiro:hasPermission>
			    </c:when>
			    <c:when test="${todo.ORDERTYPE == 3 && todo.COUNT != 0}">
					<shiro:hasPermission name="order:bsVaccineOrder:confirm">
						<p class = "orderTodo todo">【${todo.DES}】出入库单：${todo.COUNT}个；</p>
					</shiro:hasPermission>
			    </c:when>
			    <c:when test="${todo.ORDERTYPE == 6 && todo.COUNT != 0}">
					<shiro:hasPermission name="order:bsVaccineOrder:edit">
						<p class = "orderTodo todo">【${todo.DES}】出入库单：${todo.COUNT}个；</p>
					</shiro:hasPermission>
			    </c:when>
			    <c:when test="${todo.ORDERTYPE == 20 && todo.COUNT != 0}">
					<shiro:hasPermission name="order:bsVaccineOrder:pay">
						<p class = "orderTodo todo">【${todo.DES}】出入库单：${todo.COUNT}个；</p>
					</shiro:hasPermission>
			    </c:when>
			</c:choose>
		</c:forEach>
	</div>
</div>
</body>
</html>